package com.tqfframe.datamanage;
import com.tqfframe.EnableCustomBean;
import com.tqfframe.EnableCustomBeans;
import com.tqfframe.common.annotation.EnableFirstStarter;
import com.tqfframe.common.init.TestApplicationRunner;
import com.tqfframe.datamanage.config.MyWebSocketServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

/**
 * @Author: 唐祺峰
 * @Date: 2020/7/2 0002 11:51
 * @Version 1.0
 */
@SpringBootApplication
//@EnableEurekaClient  //如果是springcloud的依赖eureka，可以不需要使用EnableEurekaClient注解就能注册到Eureka
@EnableFeignClients
@EnableFirstStarter   //自己写的第一个starter
@EnableCustomBean   //自己的ImportBeanDefinitionRegistrar接口starter
@EnableCustomBeans(basePackages = "com.tqfframe.beans")   //自己的ImportBeanDefinitionRegistrar接口starter，可以一次把目录下的类放入bean容器中
@Import({TestApplicationRunner.class})
public class DataManageApplicationApp {
    public static void main(String[] args){
        SpringApplication.run(DataManageApplicationApp.class,args);
    }


    /**
     *  http://localhost:9009/socket
     *  自定义Servlet
     * @return
     */
    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        return new ServletRegistrationBean(new MyWebSocketServlet(), "/socket");
    }

}
